//
//  BlackListTableViewCell.m
//  Molian
//
//  Created by 小蚕科技 on 15/5/13.
//  Copyright (c) 2015年 xiaocan. All rights reserved.
//

#import "BlackListTableViewCell.h"
@interface BlackListTableViewCell(){
    UIView *_lineView;
}
@end;
@implementation BlackListTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    {
        
        self.textLabel.backgroundColor = [UIColor clearColor];
        _lineView = [[UIView alloc] initWithFrame:CGRectMake(0, -0.3, DeviceWidth, 0.3)];
        _lineView.backgroundColor = RGBA(225, 225, 225, 1);
        [self.contentView addSubview:_lineView];
        self.removeBt = [UIButton buttonWithType:UIButtonTypeCustom];
        self.removeBt.frame = CGRectMake(DeviceWidth-55, (65-30)/2, 45, 30);
        [self.removeBt setTitle:@"移除" forState:UIControlStateNormal];
        self.removeBt.titleLabel.font =  [UIFont fontWithName:FontName size:15];
        [self.removeBt setBackgroundImage:[UIImage imageWithColor:APPCOLOR(1)] forState:UIControlStateNormal];
        self.removeBt.layer.masksToBounds = YES;
        self.removeBt.layer.cornerRadius = 15;
        [self.removeBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.contentView addSubview:_removeBt];
        
    }
    return self;
}
- (void)layoutSubviews
{
    CGRect frame = self.imageView.frame;
    
    [self.imageView sd_setImageWithURL:_imageURL placeholderImage:_placeholderImage];
    self.imageView.frame = CGRectMake(10, (65-45)/2, 45, 45);
    // 圆角
    self.imageView.layer.masksToBounds = YES;
    [self.imageView.layer setCornerRadius:5.0f];
    self.textLabel.text = _name;
    self.textLabel.frame = CGRectMake(65, (65-24)/2, DeviceWidth-150, 24);
    frame = _lineView.frame;
    frame.origin.y = self.contentView.frame.size.height - 1;
    _lineView.frame = frame;
}
-(void)setName:(NSString *)name{
    _name = name;
    self.textLabel.text = name;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 65;
}
@end
